﻿using Grow.Log.CreateLog;
using Grow.Module.Options;
using Grow.Module.Service;

namespace Grow.Log.Serilog.Seq.CreateLog
{
    public class CreateLogBuilder : ICreateLogBuilder
    {
        private readonly IServiceContainer _serviceContainer;
        public CreateLogBuilder(IServiceContainer serviceContainer)
        {
            _serviceContainer = serviceContainer;
        }

        public ICreateLogBuilder AddLogOptions(Action<IOptionsBind, LogOptions> logOptionsAction)
        {
            _serviceContainer.OptionsManager.AddOptions<LogOptions>(a =>
            {
                logOptionsAction(_serviceContainer.OptionsManager.GetOptionsBind(), a);
            });
            return this;
        }
    }
}